<%- include('../../layouts/base/header', { title: '热门书籍' }) %>

<div class="min-h-screen">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4 md:py-8">

        <!-- 页面标题 -->
        <div class="mb-6 md:mb-8">
            <div class="flex items-center justify-between">
                <div class="flex items-center">
                    <h1 class="text-2xl md:text-3xl font-bold text-gray-900 flex items-center">
                        <i class="fas fa-fire text-red-500 mr-3"></i>
                        热门书籍
                    </h1>
                </div>
                <div class="text-sm text-gray-500 flex items-center">
                    <i class="fas fa-sort-amount-down mr-1"></i>
                    按浏览量排序
                </div>
            </div>
            <% if (pagination?.totalItems > 0) { %>
                <p class="text-gray-600 mt-2">
                    共找到 <span class="font-semibold text-red-600"><%= pagination.totalItems %></span> 本热门书籍
                </p>
            <% } %>
        </div>

        <!-- 书籍网格 -->
        <% if (data && data.length > 0) { %>
            <div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4 md:gap-6">
                <% data.forEach((book, index) => { %>
                    <%- include('../../components/book/card', { book: book, cardStyle: 'hot', showRanking: pagination && pagination.currentPage === 1, ranking: index + 1 }) %>
                <% }) %>
            </div>

            <!-- 分页组件 -->
            <% if (pagination?.totalItems > 0) { %>
                <%- include('../../components/pagination', { pagination: pagination }) %>
            <% } %>

        <% } else { %>
            <!-- 无数据状态 -->
            <div class="bg-white rounded-lg border border-gray-100 py-16 md:py-24 text-center">
                <div class="w-20 h-20 md:w-32 md:h-32 bg-gradient-to-br from-red-100 to-orange-100 rounded-full flex items-center justify-center mx-auto mb-6 md:mb-8">
                    <i class="fas fa-fire text-red-400 text-3xl md:text-5xl"></i>
                </div>
                <h3 class="text-xl md:text-3xl font-bold text-gray-900 mb-3 md:mb-4">暂无热门书籍</h3>
                <p class="text-gray-500 text-base md:text-lg mb-6 md:mb-8">还没有足够的浏览量数据</p>
                <a href="/book/explore"
                   class="inline-flex items-center px-6 py-3 bg-red-500 hover:bg-red-600 text-white font-medium rounded-lg transition-colors duration-200">
                    <i class="fas fa-compass mr-2"></i>
                    去发现书籍
                </a>
            </div>
        <% } %>

    </div>
</div>

<%- include('../../layouts/base/footer') %>